﻿using System;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using ASP.NET_MVC_Static_Test.Common;

namespace ASP.NET_MVC_Static_Test
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }

        protected void Application_BeginRequest(Object sender, EventArgs e)
        {
            //var ip = ClientHelper.GetClientIp();           
            //var visitNum = IpControlHelper.IpVisitNumber(ip);            
            //if (visitNum > 5)
            //{
            //    //Response.StatusCode = 404;
            //    //Response.End();
            //}

            //if (Context.Request.FilePath == "/")
            //{
            //    Context.RewritePath("StaticView/Index.html");
            //}
            //else
            //{
            //    var webdomain = Context.Request.FilePath.Substring(Context.Request.FilePath.IndexOf("/", StringComparison.Ordinal));
            //    Context.RewritePath($"StaticView/{webdomain}/Index.html");
            //}

        }
    }
}
